﻿using System;
using System.Collections.Generic;
using System.Text;

using Weazel.Gezel.Model;

namespace Weazel.Gezel.Conversions
{
	/// <summary>
	/// Helper structure which maps connections between inports
	/// and outports in both directions.
	/// </summary>
	public class SignalMap
	{
		private Dictionary<InPort, Signal> inportMap;

		public Signal this[InPort inport]
		{
			get
			{
				if (inportMap.ContainsKey(inport))
					return inportMap[inport];
				else
					throw new KeyNotFoundException(string.Format("could not find inport {0} in signalmap", inport.Name));
			}
			set
			{
				inportMap[inport] = value;
			}
		}		

		public bool ContainsInport(InPort inport)
		{
			return inportMap.ContainsKey(inport);
		}

		

		public SignalMap()
		{
			this.inportMap = new Dictionary<InPort, Signal>();
		}
	}
}
